package com.smart.community.property.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 物业信息统计VO
 * 用于替代Map集合，提供类型安全的统计数据返回
 * 
 * 严格按照《Java后端SpringBoot代码开发规范.md》VO规范实现：
 * - 避免使用Map集合作为返回值
 * - 提供清晰的字段定义和类型安全
 * - 使用Swagger注解进行API文档说明
 * 
 * @author Wu.Liang
 * @since 2025-01-30
 * @version 1.0.0
 */
@Data
@Schema(description = "物业信息统计数据")
public class PropertyInfoStatsVO {

    @Schema(description = "物业公司ID", required = true, example = "1015")
    private Long propertyCompanyId;

    @Schema(description = "统计时间", required = true)
    private LocalDateTime statisticsTime;

    // ========== 核心统计数据（从统计服务获取）==========
    
    @Schema(description = "总服务面积（平方米）", required = true, example = "50000.00")
    private BigDecimal totalServiceArea;

    @Schema(description = "服务社区数量", required = true, example = "5")
    private Long serviceCommunityCount;

    @Schema(description = "服务户数", required = true, example = "1200")
    private Long serviceHouseholdCount;

    // ========== 物业特有统计数据 ==========
    
    @Schema(description = "平均服务质量评分（1-5分）", example = "4.5")
    private BigDecimal averageServiceQuality;

    @Schema(description = "月收入（元）", example = "50000.00")
    private BigDecimal monthlyIncome;

    @Schema(description = "月支出（元）", example = "30000.00")
    private BigDecimal monthlyExpense;

    @Schema(description = "利润率（百分比）", example = "40.00")
    private BigDecimal profitRate;

    // ========== 扩展统计数据 ==========
    
    @Schema(description = "员工数量", example = "50")
    private Long employeeCount;

    @Schema(description = "车辆数量", example = "10")
    private Long vehicleCount;

    @Schema(description = "设备数量", example = "100")
    private Long equipmentCount;

    @Schema(description = "投诉处理率（百分比）", example = "95.00")
    private BigDecimal complaintResolutionRate;

    @Schema(description = "业主满意度（百分比）", example = "88.00")
    private BigDecimal ownerSatisfactionRate;

    // ========== 时间维度统计 ==========
    
    @Schema(description = "本月新增业主数", example = "25")
    private Long monthlyNewOwners;

    @Schema(description = "本月处理报修数", example = "150")
    private Long monthlyRepairRequests;

    @Schema(description = "本月完成报修数", example = "145")
    private Long monthlyCompletedRepairs;

    @Schema(description = "本月报修完成率（百分比）", example = "96.67")
    private BigDecimal monthlyRepairCompletionRate;

    // ========== 财务统计 ==========
    
    @Schema(description = "物业费收缴率（百分比）", example = "92.50")
    private BigDecimal propertyFeeCollectionRate;

    @Schema(description = "欠费户数", example = "45")
    private Long overdueHouseholds;

    @Schema(description = "欠费金额（元）", example = "12500.00")
    private BigDecimal overdueAmount;

    @Schema(description = "预收物业费（元）", example = "8000.00")
    private BigDecimal prepaidPropertyFees;

    // ========== 服务统计 ==========
    
    @Schema(description = "活跃服务项目数", example = "8")
    private Long activeServiceProjects;

    @Schema(description = "本月服务评价数", example = "200")
    private Long monthlyServiceReviews;

    @Schema(description = "平均服务评价分数", example = "4.3")
    private BigDecimal averageServiceReviewScore;

    @Schema(description = "紧急事件处理数", example = "3")
    private Long emergencyIncidents;

    @Schema(description = "紧急事件响应时间（分钟）", example = "15")
    private Long emergencyResponseTime;

    // ========== 设施统计 ==========
    
    @Schema(description = "电梯数量", example = "20")
    private Long elevatorCount;

    @Schema(description = "电梯正常运行率（百分比）", example = "98.50")
    private BigDecimal elevatorOperationRate;

    @Schema(description = "监控设备数量", example = "80")
    private Long surveillanceDeviceCount;

    @Schema(description = "监控设备在线率（百分比）", example = "99.20")
    private BigDecimal surveillanceDeviceOnlineRate;

    @Schema(description = "消防设备数量", example = "120")
    private Long firefightingDeviceCount;

    @Schema(description = "消防设备完好率（百分比）", example = "100.00")
    private BigDecimal firefightingDeviceIntegrityRate;

    // ========== 环境统计 ==========
    
    @Schema(description = "绿化面积（平方米）", example = "8000.00")
    private BigDecimal greenArea;

    @Schema(description = "绿化覆盖率（百分比）", example = "35.00")
    private BigDecimal greenCoverageRate;

    @Schema(description = "垃圾分类桶数量", example = "50")
    private Long garbageSortingBins;

    @Schema(description = "垃圾分类准确率（百分比）", example = "85.00")
    private BigDecimal garbageSortingAccuracy;

    // ========== 安全统计 ==========
    
    @Schema(description = "保安人员数量", example = "12")
    private Long securityPersonnelCount;

    @Schema(description = "本月安全事件数", example = "2")
    private Long monthlySecurityIncidents;

    @Schema(description = "安全事件处理率（百分比）", example = "100.00")
    private BigDecimal securityIncidentResolutionRate;

    @Schema(description = "巡逻次数（本月）", example = "180")
    private Long monthlyPatrolCount;

    @Schema(description = "平均巡逻间隔（分钟）", example = "30")
    private Long averagePatrolInterval;

    // ========== 维护统计 ==========
    
    @Schema(description = "本月维护计划数", example = "25")
    private Long monthlyMaintenancePlans;

    @Schema(description = "本月完成维护数", example = "23")
    private Long monthlyCompletedMaintenance;

    @Schema(description = "维护计划完成率（百分比）", example = "92.00")
    private BigDecimal maintenanceCompletionRate;

    @Schema(description = "设备故障数（本月）", example = "8")
    private Long monthlyEquipmentFailures;

    @Schema(description = "设备故障修复率（百分比）", example = "100.00")
    private BigDecimal equipmentFailureRepairRate;

    // ========== 通信统计 ==========
    
    @Schema(description = "本月发送通知数", example = "45")
    private Long monthlyNotifications;

    @Schema(description = "通知送达率（百分比）", example = "98.50")
    private BigDecimal notificationDeliveryRate;

    @Schema(description = "业主反馈数（本月）", example = "35")
    private Long monthlyOwnerFeedbacks;

    @Schema(description = "反馈处理率（百分比）", example = "94.30")
    private BigDecimal feedbackProcessingRate;

    // ========== 能源统计 ==========
    
    @Schema(description = "本月用电量（度）", example = "15000")
    private Long monthlyElectricityUsage;

    @Schema(description = "本月用水量（吨）", example = "800")
    private Long monthlyWaterUsage;

    @Schema(description = "本月用气量（立方米）", example = "500")
    private Long monthlyGasUsage;

    @Schema(description = "能源消耗同比变化（百分比）", example = "-5.20")
    private BigDecimal energyConsumptionChange;

    // ========== 成本统计 ==========
    
    @Schema(description = "人工成本（本月，元）", example = "45000.00")
    private BigDecimal monthlyLaborCost;

    @Schema(description = "材料成本（本月，元）", example = "15000.00")
    private BigDecimal monthlyMaterialCost;

    @Schema(description = "能源成本（本月，元）", example = "8000.00")
    private BigDecimal monthlyEnergyCost;

    @Schema(description = "其他成本（本月，元）", example = "5000.00")
    private BigDecimal monthlyOtherCosts;

    @Schema(description = "总成本（本月，元）", example = "73000.00")
    private BigDecimal monthlyTotalCost;

    // ========== 效率统计 ==========
    
    @Schema(description = "平均响应时间（分钟）", example = "25")
    private Long averageResponseTime;

    @Schema(description = "平均处理时间（小时）", example = "2.5")
    private BigDecimal averageProcessingTime;

    @Schema(description = "工作效率指数", example = "85.50")
    private BigDecimal workEfficiencyIndex;

    @Schema(description = "客户满意度指数", example = "87.30")
    private BigDecimal customerSatisfactionIndex;

    // ========== 趋势统计 ==========
    
    @Schema(description = "收入增长率（百分比）", example = "8.50")
    private BigDecimal revenueGrowthRate;

    @Schema(description = "成本控制率（百分比）", example = "92.00")
    private BigDecimal costControlRate;

    @Schema(description = "服务质量提升率（百分比）", example = "5.20")
    private BigDecimal serviceQualityImprovementRate;

    @Schema(description = "业主满意度提升率（百分比）", example = "3.80")
    private BigDecimal ownerSatisfactionImprovementRate;
}
